#include <vector>
#include <algorithm>
#include <iostream>

using namespace std;

int makingChange(int amount, int limit, vector<int> coins) {
  int ways = 0;
  int coin = coins.back();
  coins.pop_back();

  if (coins.size() == 0) {
    if (amount / coin <= limit && amount % coin == 0) {
      return 1;
    }
    else {
      return 0;
    }
  }
  else {
    for (int i = 0; i <= amount / coin; ++i) {
      ways += makingChange(amount - coin * i, limit - i, coins);
    }
  }

  return ways;
}

int solution() {
  //return makingChange(1000, 15, {10, 50, 100, 500});
  return makingChange(20, 5, {4, 10});
}

int main(int argc, char const *argv[])
{
  /* code */
  cout << solution() << endl;
  return 0;
}
